package com.lyrcsoft.aspect;

import com.lyrcsoft.services.IUserExtendSerivce;
import com.lyrcsoft.services.impl.UserExtendSerivceImpl;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author fujc2dev@126.com
 * @date 2024-01-16 16:46
 */
@Component
@Aspect
public class MyAspect {


	/**
	 * 可以给我们已经定义好的Bean增加一个扩展接口
	 * <p>
	 *
	 * </p>
	 */
	@DeclareParents(value = "com.lyrcsoft.services.UserService", defaultImpl = UserExtendSerivceImpl.class)
	private IUserExtendSerivce userExtendSerivce;

	/**
	 * Spring Aop（AnnotationAwareAspectJAutoProxyCreator）的核心就是将下面的这个方法转换为Pointcut、Advice
	 *
	 * @param joinPoint
	 */
	@Before("execution(public  * com.lyrcsoft.services.UserService.test())")  //Pointcut
	public void before(JoinPoint joinPoint) { // Advice
		// JoinPoint joinPoint
		System.out.println("before");
	}
}
